'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up (queryInterface, Sequelize) {
    const { INTEGER, STRING, DATE, ENUM } = Sequelize;
    await queryInterface.createTable("user", {
      id: {
        type: INTEGER(20).UNSIGNED,
        primaryKey: true,
        autoIncrement: true,
      },
      username: {
        type: STRING(30),
        allowNull: false,
        defaultValue: "",
        comment: "用户名称",
        unique: true,
      },
      nickname: {
        type: STRING(30),
        allowNull: false,
        defaultValue: "",
        comment: "...",
      },
      email: {
        type: STRING(160),
        comment: "用户邮箱",
        unique: true,
      },
      password: {
        type: STRING(200),
        allowNull: false,
        defaultValue: "",
      },
      avatar: {
        type: STRING(200),
        allowNull: true,
        defaultValue: "",
      },
      phone: {
        type: STRING(20),
        comment: "用户手机",
        unique: true,
      },
      sex: {
        type: ENUM,
        values: ["男", "女", "保密"],
        allowNull: true,
        defaultValue: "男",
        comment: "用户性别1",
      },
      status: {
        type: INTEGER(1),
        allowNull: false,
        defaultValue: 1,
        comment: "状态 0禁用1启用",
      },
      sign: {
        type: STRING(200),
        allowNull: true,
        defaultValue: "",
        comment: "个性签名",
      },
      area: {
        type: STRING(200),
        allowNull: true,
        defaultValue: "",
        comment: "地区",
      },
     
      created_at: DATE,
      updated_at: DATE,
    });
    /**
     * Add altering commands here.
     *
     * Example:
     * await queryInterface.createTable('users', { id: Sequelize.INTEGER });
     */
  },

  async down (queryInterface, Sequelize) {
    await queryInterface.dropTable("user");
    /**
     * Add reverting commands here.
     *
     * Example:
     * await queryInterface.dropTable('users');
     */
  }
};
